package com.jacobson.huobi.utils

import android.content.Context
import android.os.Build
import androidx.annotation.ColorRes
import androidx.annotation.StringRes
import com.jacobson.huobi.HuobiApplication

/**
 * ================================================
 *
 *  @author Wucz on 2018-09-07 17:40
 * ================================================
 */
object ResourcesUtil {
    fun getColor(@ColorRes colorRes: Int): Int {
        return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            HuobiApplication.getInstance().getColor(colorRes)
        } else {
            HuobiApplication.getInstance().resources.getColor(colorRes)
        }
    }

    fun formatString(@StringRes strId: Int, vararg args: Any): String {
        return formatString(HuobiApplication.getInstance(), strId, *args)
    }

    fun formatString(context: Context, @StringRes strId: Int, vararg args: Any): String {
        return context.resources.getString(strId, *args)
    }
}